<?php defined( '_MAXSITE' ) or die( 'Restricted access' );
/**
 * @package	Atomymaxsite - Maxsite
 * @license	LICENSE.txt
 * @license	GNU General Public License version 2 or later; see LICENSE.txt
 * @since	Version 2.5.0
 */
$smiletagURL = 'modules/smiletag/';
?>

<!-- Edit HTML Below to customize the look of your smiletag form and iframe -->

<style type="text/css">
.smiletagFrame{
	border-right: #cccccc 1px solid;
	border-top: #cccccc 1px solid;
	border-left: #cccccc 1px solid;
	border-bottom: #cccccc 1px solid;
}
#smiley_box{
	width:90px;
	position:absolute;
	display:none;
	margin-left: 55px;
}
#smiley_box .smiley_top{
	background: url(modules/smiletag/images/smiley_top.png);
	background-repeat:no-repeat;
	height:30px;
	padding-left: 36px;
	
}
#smiley_box .smiley_middle{
	background: url(modules/smiletag/images/smiley_middle.png);
	background-repeat:repeat-y;	
	background-position:bottom left;
	padding-left:7px;
	padding-right:7px;
	padding-bottom: 0px;
	padding-top: 0px;
	margin-top: 0px;
	
}
#smiley_box .smiley_middle span{
	position:relative;
}
#smiley_box .smiley_bottom{
	background: url(modules/smiletag/images/smiley_bottom.png);
	background-repeat:no-repeat;
	background-position:bottom left;
	height:44px;
	top:-6px;
	
}
#smiley_box a {
	float: left; text-decoration: none
}
#smiley_box a:link {
	color: #808080
}
#smiley_box a:hover {
	color: #333; background-color: #efefef
}
#smiley_box a:active {
	color: #808080
}
#smiley_box a:visited {
	color: #808080
}
#smiley_box img {
	border: 0;
}
#sh_box{
    list-style-image: none;
    list-style-type: none;
    margin: 0px;
    padding: 0px;
    text-align: left;
    word-wrap: break-word;
    width: 210px;
    overflow: scroll;
    height: 230px;
}
#sh_box a{
    color: red;
}
#sh_box li{
    padding: 3px 3px 3px 3px;
    margin: 4px 0px;
    border-top: 1px solid #CCC;
    border-bottom: 1px solid #CCC;
}
#sh_box li:nth-child(odd) { background-color: #FCE7FF; }
#sh_box li:nth-child(even) { background-color: #DFECFF; }
</style>
<script type="text/javascript">
    
    var smiletagURL = "<?php echo $smiletagURL; ?>";
    
$(function(){
    $('#smiletagform').submit(function(){
        
        var name=$('#smiletagform #name');
        var msg_box=$('#smiletagform #message_box');
        if($.trim(name.val())=='' || $.trim(msg_box.val())=='')
        {
            alert('<?php echo _SMILE_FORM_CHECK?>');
            return false;
        }
        else
        {
            $.ajax({
                type: "POST",
                url: "index3.php?name=smiletag&file=view_shoutbox",
                data: $('#smiletagform').serialize()+'&op=save',
                dataType: 'json',
                success: function(msg){
                    if(msg.success==true)
                    {
                        $('#sh_box').prepend(msg.message);
                        msg_box.val('');
                        $('img#captcha_refresh').attr('src', function(i, value){ return value+'&r='+Math.random(); });
                    }
                    else
                    {
                        alert(msg.message);
                        return false;
                    }
                }
            }); // End Ajax
        }
        return false;
    }); // End submit
    
<?php
if($admin_user!='')
{
?>
    $('a.del_box').live('click', function(e){
        e.preventDefault;
        
        var r=confirm('<?php echo _SMILE_LIST_DEL?>');
        if(r==true)
        {
            var id=$(this).attr('id');
            $.ajax({
                type: "POST",
                url: "index3.php?name=smiletag&file=view_shoutbox",
                data: 'id='+id+'&op=del_box',
                dataType: 'json',
                success: function(msg){
                    if(msg.success==true)
                    {
                        $('a#'+id).parent('li').remove();
                    }
                }
            }); // End Ajax
        }
        else
        {
            return false;
        }
        return false;
    });
<?php
}
    ?>
});
</script>
<script type="text/javascript" src="<?php echo $smiletagURL; ?>smiletag-script.js"></script>

<form id="smiletagform" name="smiletagform" method="post" action="<?php echo $smiletagURL; ?>post.php" >
<table border="0" cellpadding="0" cellspacing="0" width="<?=$widthSUM-5;?>">
        <tr>
        <td valign="top" align=center width="100%">
<!--      		<iframe name="iframetag" marginwidth="0" marginheight="0" src="<?php echo $smiletagURL; ?>view.php" width="<?=$widthSUM-5;?>" height="192" frameborder="0" class="smiletagFrame">
        Your Browser must support IFRAME to view
        this page correctly
        </iframe>-->
            <div style="display:block; height: 230px; overflow: hidden;">
                <ul id="sh_box">
                <?php 
                require_once('modules/smiletag/view_shoutbox.php');
                ?>
                </ul>
            </div>
        </td>
        </tr>
        <tr>
        <td align=left>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#F7F7F7" width="100%">
        <tr>
        <td align="right">
              <b><?=_SMILE_NAME_ADD;?> </b>
        </td>
        <td>
            <input type="text" id="name" name="name" <?if($_SESSION['login_true']){echo "value=\"".$_SESSION['login_true']."\" readonly style=\"color: #FF0000\" ";};?><?if($_SESSION['admin_user']){echo "value=\"".$_SESSION['admin_user']."\" readonly style=\"color: #FF0000\" ";};?> size="15" />
        </td>
        </tr>


<?
if($_SESSION['login_true'] || $_SESSION['admin_user']){
} else {
    if(USE_CAPCHA){
    ?>
<tr><td align="right">
<table width="80%" border="0" cellspacing="5" cellpadding="0">
<TR>
<TD align=center>
<?php
echo "<img id=\"captcha_refresh\" src=\"capcha/CaptchaSecurityImages.php?width=".CAPCHA_WIDTH."&height=".CAPCHA_HEIGHT."&characters=".CAPCHA_NUM."\" width=\"".CAPCHA_WIDTH."\" height=\"".CAPCHA_HEIGHT."\" align=\"absmiddle\" />";
?>
</TD></tr>
</table></td>
<TD align=left><input name="security_code" type="text" id="security_code" size="10" maxlength="5" style="width:60" >  
    </td>
    </tr>
    <?
    }
}
?>
    <tr>
        <td colspan="2">
            <?=_SMILE_DETAIL;?> 
            <div id="smiley_box">
                <div class="smiley_top">
                    <a href="javascript:hideSmileyWindow();">
                        <img src="<?php echo $smiletagURL;?>images/delete_icon.gif" alt="Close" />
                    </a>
                </div>
                <div class="smiley_middle">
                    <div id="smiley_box_content" style="padding: 0px;" >
                        <table width="80%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td align="center"><a href="javascript:insertSmiley(':)');"><img src="<?php echo $smiletagURL;?>images/smilies/smile.gif" alt=":)" /></a></td>
                            <td align="center"><a href="javascript:insertSmiley(':D');"><img src="<?php echo $smiletagURL;?>images/smilies/laugh.gif" alt=":D" /></a></td>
                            <td align="center"><a href="javascript:insertSmiley(':(');"><img src="<?php echo $smiletagURL;?>images/smilies/sad.gif" alt=":(" /></a></td>
                        </tr>
                        <tr>
                            <td align="center"><a href="javascript:insertSmiley(':o');"><img src="<?php echo $smiletagURL;?>images/smilies/shock.gif" alt=":o" /></a></td>
                            <td align="center"><a href="javascript:insertSmiley(':p');"><img src="<?php echo $smiletagURL;?>images/smilies/tongue.gif" alt=":p" /></a></td>
                            <td align="center"><a href="javascript:insertSmiley(';)');"><img src="<?php echo $smiletagURL;?>images/smilies/wink.gif" alt=";)" /></a></td>
                        </tr>
                        <tr>
                            <td align="center"><a href="javascript:insertSmiley(':|');"><img src="<?php echo $smiletagURL;?>images/smilies/blah.gif" alt=":|" /></a></td>
                            <td align="center"><a href="javascript:insertSmiley('x(');"><img src="<?php echo $smiletagURL;?>images/smilies/mad.gif" alt="x(" /></a></td>
                            <td align="center"><a href="javascript:insertSmiley(':~');"><img src="<?php echo $smiletagURL;?>images/smilies/drool.gif" alt=":~" /></a></td>
                        </tr>
                        </table>
                    </div>
                </div>
                <div class="smiley_bottom"></div>
            </div>
            <a href="<?=WEB_URL;?>" onclick="showSmileyWindow(event);return false">(<?=_SMILE_SMILE;?>)</a>
        </td>
    </tr>
    <tr>
        <td align="center" colspan="2">
            <textarea id="message_box" name="message_box" rows="5" cols="25"></textarea>
            <input type="hidden" name="message" value="" />
            <div align=center>
                <input type="submit" name="submit" value="<?=_SMILE_BUTTON_SEND;?>" /> 
                <input type="reset"  name="reset" value="<?=_SMILE_BUTTON_CLEAR;?>" />
            </div>
        
        </td>
    </tr>
</table>
</td>
</tr>
</table>
</form>
